package com.juzipi.demo.service;

import com.juzipi.demo.mapper.UserMapper;
import com.juzipi.demo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;


    public User selectUserById(Integer id){
        return this.userMapper.selectByPrimaryKey(id);
    }

    public List<User> selectUserAll(){
        return this.userMapper.selectAll();
    }

    public int deleteById(Integer id){
        return this.userMapper.deleteByPrimaryKey(id);
    }

    public int insert(User user){
        return this.userMapper.insert(user);
    }

    public int update(User user){
        //根据ID修改数据
        return this.userMapper.updateByPrimaryKey(user);
    }
}
